package com.kxf.checkapksoplugin;

import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ProjectConnection;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class TestProjectConn {
    public static void main(String[] args) {
        String workingDir = System.getProperty("user.dir");

        ProjectConnection connection = GradleConnector.newConnector()
                .forProjectDirectory(new File(workingDir))
                .connect();
        try {
            Map<String, String> map = new HashMap<>();
            map.put("--configuration","debugCompileClasspath");
            map.put("--dependency","solibtest");
            connection.newBuild().forTasks(":app:dependencyInsight")
                    .setStandardOutput(System.out)
//                    .setEnvironmentVariables(map)
                    .withArguments("--dependency", "solibtest")//"--configuration","debugCompileClasspath",
                    .run();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            connection.close();
        }
    }
}
